<?php

namespace addon\lian\event;

use addon\lian\model\core\member\CoreLianDataService;
use addon\lian\model\sqlmodel\LianMemberModel;


class CronLianCheck
{
    public function handle($params = [])
    {
        Log::info('=========链动2+1解冻校验=========');

        try {
            $list = (new LianMemberModel())->where('thaw_status', '=', 0)->where('frozen_commission', '>', 0)->select();
            if(!empty($list)){

                $ids = array_column($list->toArray(), 'id');
                (new CoreLianDataService())->handleQueue($ids);
            }

            Log::write('链动绩效任务统计查验任务执行成功');
            return true;
        } catch (\Exception $e) {
            Log::write('链动绩效任务统计查验任务执行失败' . $e->getMessage());
            return false;
        }
    }
}